import { TableColumns } from '@pureadmin/table'

import { fenToYuan } from '@/utils'

interface TableColumnList extends Array<TableColumns> {}

export function useUser() {
  const columns: TableColumnList = [
    // {
    //   label: '勾选列', // 如果需要表格多选，此处label必须设置
    //   type: 'selection',
    //   minWidth: 55,
    //   fixed: 'left',
    //   reserveSelection: true // 数据刷新后保留选项
    // },
    { prop: 'tenantName', label: '门店', minWidth: 100, align: 'center' },

    { prop: 'nickname', label: '员工', minWidth: 150, align: 'left', slot: 'nickname' },

    {
      prop: 'totalPrice',
      label: '实收业绩',
      minWidth: 100,
      align: 'center',

      formatter({ totalPrice }) {
        return fenToYuan(totalPrice)
      }
    },
    {
      prop: 'balance',
      label: '销售业绩',
      minWidth: 100,
      align: 'center',

      formatter({ balance }) {
        return fenToYuan(balance)
      }
    },
    {
      prop: 'repayPrice',
      label: '还款业绩',
      minWidth: 100,
      align: 'center',

      formatter({ ppcBalance }) {
        return fenToYuan(ppcBalance)
      }
    },
    {
      prop: 'ppcBalance',
      label: '充值业绩',
      minWidth: 100,
      align: 'center',

      formatter({ ppcBalance }) {
        return fenToYuan(ppcBalance)
      }
    },

    {
      prop: 'arrearsPrice',
      label: '划卡业绩',
      minWidth: 100,
      align: 'center',

      formatter({ arrearsPrice }) {
        return fenToYuan(arrearsPrice)
      }
    },
    {
      prop: 'debtsPrice',
      label: '消耗业绩',
      minWidth: 100,
      align: 'center',

      formatter({ debtsPrice }) {
        return fenToYuan(debtsPrice)
      }
    },
    {
      prop: 'serviceNum',
      label: '手工数量',
      minWidth: 100,

      align: 'center'
    },
    {
      prop: 'debtsPrice',
      label: '手工费用',
      minWidth: 100,
      align: 'center',

      formatter({ debtsPrice }) {
        return fenToYuan(debtsPrice)
      }
    },

    {
      label: '操作',
      fixed: 'right',
      minWidth: 100,
      align: 'center',
      slot: 'operation'
    }
  ]

  return {
    columns
  }
}
